import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

//准备actions对象——响应组件中用户的动作
const actions = {
	jia(miniStore,value){
		miniStore.commit('JIA',value)
	},
	jian({commit},value){
		commit('JIAN',value)
	}
}
//准备mutations对象——修改state中的数据
const mutations = {
	JIA(state,value){
		state.sum += value
	},
	JIAN(state,value){
		state.sum -= value
	}
}
//准备state对象——初始化数据
const state = {
	sum:0
}

const store = new Vuex.Store({
	actions,
	mutations,
	state
})

export default store

